Component({
  properties: {},
  data: {
    visible: false,
    icon: "account",
    type: "common",
    mark: true,
    txt: "加载中...",
  },
  methods: {
    handleStop(e) {
      return true;
    },
    show(options) {
      let map = {
        "account": "会员支付",
        "wx": "微信支付"
      };
      if (options) {
        let icon = options.icon ? options.icon : "";
        let txt = options.txt || (map[options.icon] ? map[options.icon] : "加载中");
        let mark = options.mark ? options.mark : true;
        let type = "common";
        if (options.type) {
          type = options.type;
        }
        this.setData({icon: icon, txt: txt, mark: mark, type: type, visible: true})
        if (options.time) {
          setTimeout(() => {
            this.setData({visible: false})
          }, options.time)
        }
      } else {
        this.setData({visible: true})
      }

    },
    message(txt, time) {
      let type = 'txt';
      let mark = false;
      let visible = true;
      if (!time) {
        time = 1500
      }
      this.setData({txt, mark, type, visible})
      setTimeout(() => {
        this.setData({visible: false})
      }, time)
    },
    showMark() {
      let type = 'mark';
      let mark = true;
      let visible = true;
      this.setData({mark, type, visible})
    },
    hide() {
      let visible = false;
      let mark = true;
      this.setData({mark, visible})
    },
  }
});
